<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}系统主页{% endblock %}</title>
    <style>
        .navbar {
            /* 导航栏背景色修改 */
            background-color: rgba(121, 159, 33, 0.852);
            padding: 10px;
            position: relative;
        }
        
        /* 汉堡按钮样式 */
        .menu-toggle {
            display: none;
            background: none;
            border: none;
            color: white;
            font-size: 24px;
            cursor: pointer;
            padding: 10px 15px;
        }
        
        .nav-links {
            display: flex;
            align-items: center;
        }
        
        .navbar a {
            color: white;
            text-decoration: none;
            padding: 10px 15px;
            display: inline-block;
        }
        
        .navbar a:hover {
            background-color: rgba(90, 119, 24, 0.85);
        }
        
        /* 用户信息区域样式 */
        .user-section {
            margin-left: auto;
            color: white;
            padding: 10px 15px;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        /* 退出登录链接样式 */
        .logout-link {
            color: #1a73e8;
            text-decoration: underline;
            cursor: pointer;
            padding: 0 5px;
        }
        
        .logout-link:hover {
            color: #0d47a1;
            background: none;
        }
        
        .content {
            padding: 20px;
        }
        
        /* 响应式设计 - 小屏幕时 */
        @media (max-width: 768px) {
            .menu-toggle {
                display: block;
            }
            
            .nav-links {
                display: none;
                flex-direction: column;
                width: 100%;
                margin-top: 10px;
            }
            
            .nav-links.active {
                display: flex;
            }
            
            .user-section {
                margin-left: 0;
                width: 100%;
                justify-content: center;
                border-top: 1px solid rgba(90, 119, 24, 0.85);
                margin-top: 10px;
                padding-top: 10px;
            }
        }
    </style>
</head>
<body>
    <div class="navbar">
        <!-- 汉堡按钮 - 小屏幕显示 -->
        <button class="menu-toggle" id="menuToggle">☰</button>
        
        <!-- 导航链接容器 -->
        <div class="nav-links" id="navLinks">
            <a href="{{ url_for('main.home') }}">首页</a>
            <a href="{{ url_for('main.performance') }}">查业绩</a>
            <a href="{{ url_for('main.inventory') }}">查库存</a>
            <a href="{{ url_for('main.inventory_check') }}">查盘点单</a>
            
            <!-- 用户信息和退出登录区域 -->
            <div class="user-section">
                当前用户: {{ username }}
                <a href="{{ url_for('auth.logout') }}" class="logout-link">【退出登录】</a>
            </div>
        </div>
    </div>
    <div class="content">
        {% block content %}{% endblock %}
    </div>

    <script>
        // 导航栏折叠功能
        const menuToggle = document.getElementById('menuToggle');
        const navLinks = document.getElementById('navLinks');
        
        menuToggle.addEventListener('click', () => {
            // 切换导航菜单显示状态
            navLinks.classList.toggle('active');
            
            // 按钮图标切换（汉堡 ↔ 关闭）
            menuToggle.textContent = navLinks.classList.contains('active') ? '✕' : '☰';
        });
    </script>
</body>
</html>
    